package com.wanshi.entity;

import com.wanshi.utils.Constants;

import java.io.Serializable;
import java.util.List;

public class Result<T>  implements Serializable {

    private int code;

    private String message;

    private T obj;



    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public T getObj() {
        return obj;
    }

    public void setObj(T obj) {
        this.obj = obj;
    }



    public Result() {
    }

    public Result(int code) {
        this.code = code;
    }

    public Result(int code, String message) {
        this.code = code;
        this.message = message;
    }

    public Result(int code, String message, T obj) {
        this.code = code;
        this.message = message;
        this.obj = obj;
    }



    public static Result ok(){
        return new Result(Constants.SUCCESS,"成功");
    }

    public static Result error(){
        return new Result(Constants.ERROR,"失败");
    }

    public static Result ok(Object obj){
        return new Result(Constants.SUCCESS,"成功",obj);
    }


}
